package com.iespring.controller.admin.category;

import com.iespring.bean.admin.brand.bo.BrandBo;
import com.iespring.bean.admin.brand.po.BrandPo;
import com.iespring.bean.admin.category.bo.CategoryBo;
import com.iespring.bean.admin.category.po.CategoryPo;
import com.iespring.bean.admin.category.vo.CategoryVo;
import com.iespring.bean.common.BasePageInfo;
import com.iespring.bean.common.BaseRespVo;
import com.iespring.bean.common.CommonData;
import com.iespring.service.admin.brand.BrandService;
import com.iespring.service.admin.category.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author weigwen
 * @Description:
 * @Date 2022/12/29 17:03
 */

@RestController
@RequestMapping("admin")
public class CategoryController {

    @Autowired
    CategoryService categoryService;

    @GetMapping("category/list")
    public BaseRespVo categoryList() {
        CommonData commonData = categoryService.categoryList();
        return BaseRespVo.ok(commonData);
    }

    @GetMapping("category/l1")
    public BaseRespVo categoryL1() {
        CommonData commonData = categoryService.categoryL1();
        return BaseRespVo.ok(commonData);
    }

    @PostMapping("category/create")
    public BaseRespVo categoryCreate(@RequestBody CategoryPo categoryPo){
        BaseRespVo baseRespVo = categoryService.categoryCreate(categoryPo);
        return baseRespVo;
    }

    @PostMapping("category/update")
    public BaseRespVo categoryUpdate(@RequestBody CategoryBo categoryBo){
        BaseRespVo baseRespVo = categoryService.categoryUpdate(categoryBo);
        return baseRespVo;
    }

    @PostMapping("category/delete")
    public BaseRespVo categoryDelete(@RequestBody CategoryBo categoryBo){
        BaseRespVo baseRespVo = categoryService.categoryDelete(categoryBo);
        return baseRespVo;
    }


//    @PostMapping("brand/delete")
//    public BaseRespVo brandDelete(@RequestBody BrandPo brandPo){
//        BaseRespVo baseRespVo = brandService.brandDelete(brandPo);
//        return baseRespVo;
//    }

}
